package com.atbeijing.bigdata.spark.core.acc;

import java.util.HashMap;
import java.util.Map;

public class WordCountAnalysis {
    private Map<String, Integer> wcm = new HashMap<>();

    public void add( String word ) {
        Integer cnt = wcm.get(word);
        if ( cnt == null ) {
            cnt = 0;
        }
        wcm.put(word, cnt + 1);
    }
    public Map<String, Integer> analysisSesult() {
        return wcm;
    }

    public WordCountAnalysis merge(WordCountAnalysis other) {
        //Map<String, Integer> map1 = wcm;
        //Map<String, Integer> map2 = other.analysisSesult();
        return this;
    }
}
